function User(name, interests) {
    this.name = name;
    this.interests = interests;
    this.greeting = function() {
        console.log('Hi, I\'m ' + this.name + ".");
    }
}

//prototype是在JavaScript中父类为子类提供继承的方法的方式
User.prototype.greeting = function() {
    console.log('*****Hi, I\'m ' + this.name + ".");
}

//将 Object.create()方法使用
//User构造函数的prototype
var user = Object.create(User.prototype, {
    name: {value: 'Sunny'},
    interests: {value: ['Traveling', 'Swimming4']}
});

console.log(user.name);

//greeting函数在User.prototype中定义，
user.greeting();

